package test.core.fun;

import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;

import org.apache.commons.net.ntp.NTPUDPClient;
import org.apache.commons.net.ntp.TimeInfo;
import org.apache.commons.net.ntp.TimeStamp;

import hyl.core.MyFun;
import hyl.core.fun.MyDate1;

public class testntp {
	public static void main(String[] args) throws Exception {
		long a=MyFun.getMs();
	
//		try {
//			NTPUDPClient timeClient = new NTPUDPClient();
//			String timeServerUrl ="202.120.2.101"; // "cn.pool.ntp.org";//
//			InetAddress timeServerAddress = InetAddress.getByName(timeServerUrl);
//			TimeInfo timeInfo = timeClient.getTime(timeServerAddress);
//			TimeStamp timeStamp = timeInfo.getMessage().getTransmitTimeStamp();
//			System.out.println(timeStamp.getTime());
//			
//
//		} catch (UnknownHostException e) {
//			e.printStackTrace();
//		}
		MyFun.print(	MyDate1.getTimestamp(null));
		System.out.println(MyFun.getMs()- a);
		MyFun.print(	MyDate1.getTimestamp(MyDate1.WALIYUN));
		System.out.println(MyFun.getMs()- a);
		MyFun.print(	MyDate1.getTimestamp(MyDate1.WALIYUN));
		System.out.println(MyFun.getMs()- a);
		//MyDate1.udpNtp();
	}
}
